Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds preservation of newlines between statements in formatter #405

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomasnyberg
Copy link
Contributor

Description

PR #382 added preservation of explicit newlines, but only between different clauses. As a result, in queries like:

MATCH (a)
RETURN a;

MATCH (b)
RETURN b;

the blank line after a; is removed. This PR allows preserving newlines between statements, so that users can separate statements with a blank line.

Testing

4 new simple tests for statements with newlines after them

@@ -414,6 +414,7 @@ export class TreePrintVisitor extends CypherCmdParserVisitor<void> {
this.currentBuffer().pop();
}
this.visit(ctx.SEMICOLON(i));
this.preserveExplicitNewlineAfter(ctx.SEMICOLON(i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the semicolon still be visited?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants